import java.util.Scanner;

public class draw {

    // 属性：高度
    private int high;

    // 构造方法：设置高度
    public draw(int high) {
        this.high = high;
        System.out.println("Draw()");
    }

    // 绘制三角形
    public void drawTriangle() {
        for (int i = 1; i <= high; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    // 绘制矩形
    public void drawRectangle() {
        for (int i = 0; i < high; i++) {
            for (int j = 0; j < high * 2; j++) { // 矩形的宽度设为 2 * height
                System.out.print("*");
            }
            System.out.println();
        }
    }

    // 绘制正方形
    public void drawSquare() {
        for (int i = 0; i < high; i++) {
            for (int j = 0; j < high; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    // 绘制平行四边形
    public void drawParallelogram() {
        for (int i = 0; i < high; i++) {
            // 打印空格
            for (int j = 0; j < i; j++) {
                System.out.print(" ");
            }
            // 打印星号
            for (int j = 0; j < high; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        // 输入高度
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入高度：");
        int high = scanner.nextInt();

        // 创建 Draw 对象
        draw dra1 = new draw(high);

        // 绘制三角形
        System.out.println("三角形：");
        dra1.drawTriangle();

        // 绘制矩形
        System.out.println("矩形：");
        dra1.drawRectangle();

        // 绘制正方形
        System.out.println("正方形：");
        dra1.drawSquare();

        // 绘制平行四边形
        System.out.println("平行四边形：");
        dra1.drawParallelogram();
    }
}
